const configData = require('./config/config.json').development;
const { Sequelize } = require('sequelize');

async function checkItem() {
  try {
    const sequelize = new Sequelize(configData.database, configData.username, configData.password, {
      host: configData.host,
      dialect: configData.dialect
    });

    await sequelize.authenticate();
    console.log('Connection has been established successfully.');

    // 检查特定批次的数据项
    const [results] = await sequelize.query(
      'SELECT item_id, batch_id, category, status, response_data FROM plugin_data_items WHERE batch_id = "test_batch_005"'
    );
    
    console.log('Plugin data item for test_batch_005:');
    results.forEach((item, index) => {
      console.log(`${index + 1}. Item ID: ${item.item_id}`);
      console.log(`   Batch ID: ${item.batch_id}`);
      console.log(`   Category: ${item.category}`);
      console.log(`   Status: ${item.status}`);
      console.log(`   Response data: ${JSON.stringify(item.response_data, null, 2)}`);
    });

    await sequelize.close();
  } catch (error) {
    console.error('Unable to connect to the database:', error);
  }
}

checkItem();